
import { Toast, Dialog, Notify } from 'vant'
export default {
  // 消息提示
  msg(content: string) {
    Toast({ message: content, position: 'top', });
  },
  // 错误消息
  msgError(content: string) {
    Toast.fail({ message: content, position: 'top', });
  },
  // 成功消息
  msgSuccess(content: string) {
    Toast.success({ message: content, position: 'top', });
  },
  // 通知提示
  notify(content: string) {
    Notify({ type: 'primary', message: content });
  },
  // 错误通知
  notifyError(content: string) {
    Notify({ type: 'danger', message: content });
  },
  // 成功通知
  notifySuccess(content: string) {
    Notify({ type: 'success', message: content });
  },
  // 警告通知
  notifyWarning(content: string) {
    Notify({ type: 'warning', message: content });
  },

  // 弹出提示
  alert(content: string,title?:string) {
    Dialog.alert({ message: content, title: title||"系统提示" })
  },

  // 确认窗体
  confirm(content: string,title?:string) {
    return Dialog.confirm({
      message: content, title: title||"系统提示",
      confirmButtonText: '确定',
      cancelButtonText: '取消',
    })
  },

  // 打开遮罩层
  loading(content: string) {
    Toast.loading({
      message: content || '加载中...',
      type: "loading",
      duration: 0,
    });
  },
  // 关闭遮罩层
  closeLoading() {
    Toast.clear();
  }
}
